* ======================================
* ----------- Import persons -----------
* ======================================


	use "$dta_raw\dta10\W19_0078_FASTE_OPPL.dta", clear

	rename w19 idPers
	rename foedselsaar birthyear
	rename invkat immigrantcat
	rename fodeland birthcountry

	gen deathyear = substr(doeds,1,4)
	gen deathmonth = substr(doeds,5,2)
	gen female = 1*(kjoenn == "2")
	gen Scandinavian = 1*(birthcountry == "000" | birthcountry == "101" ///
		| birthcountry == "106")
	gen immigrant = 1*(immigrantcat == "B" & Scandinavian == 0)

	destring birthyear, replace
	destring deathyear, replace
	destring deathmonth, replace
	
	keep idPers birthyear death* immigrant birthcountry female
	sort idPers
	
	save "$dta\ImportPers.dta",replace

